package com.qf.flash.ui.home.adapter;

import android.widget.ImageView;

import com.qf.flash.R;
import com.qf.flash.model.ScriptRoomBean;
import com.qf.flash.utils.ImageLoader;
import com.qf.flashlib.adapter.BaseRViewItem;
import com.qf.flashlib.adapter.RViewHolder;
import com.qf.flashlib.util.DensityUtil;

/**
 * 2020/3/4 17:51
 */
public class HotGridItem extends BaseRViewItem<ScriptRoomBean> {

    @Override
    public int getSpanSize() {
        return 1;
    }

    @Override
    public boolean isItemView(ScriptRoomBean entity, int position) {
        return entity.getSpanSize() == 0;
    }

    @Override
    public int getItemLayout() {
        return R.layout.item_hote_grid;
    }

    @Override
    public void convert(RViewHolder holder, ScriptRoomBean entity, int position, int itemSize) {
        ImageView ivImg = holder.getView(R.id.iv_img);
        ImageLoader.loadRoundCorners(holder.getmConvertView().getContext(), entity.getImage(), ivImg,
                DensityUtil.dp2px(ivImg.getContext(),5));
        holder.setText(R.id.tv_name, entity.getName());
    }
}
